package com.apps.ftapp.adapter;

import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.RecyclerView;

import com.apps.ftapp.R;
import com.apps.ftapp.bean.LogisticsDetailModel;
import com.apps.ftapp.holder.TimeLineViewHolder;

import java.util.List;


/**
 * Created by lyli on 2017/11/1.
 */

public class TimeLineAdapter extends RecyclerView.Adapter<TimeLineViewHolder> {


    private List<LogisticsDetailModel.NwuliuBean> mFeedList;


    public TimeLineAdapter(List<LogisticsDetailModel.NwuliuBean> feedList) {
        mFeedList = feedList;
    }

    public void addRes(List<LogisticsDetailModel.NwuliuBean> data) {
        if (data != null) {
//            this.dataList.clear();
            this.mFeedList.addAll(data);
            notifyDataSetChanged();
        }
    }

    @Override
    public TimeLineViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(parent.getContext(), R.layout.wuliu, null);
        return new TimeLineViewHolder(view);
    }

    @Override
    public void onBindViewHolder(TimeLineViewHolder holder, int position) {

        LogisticsDetailModel.NwuliuBean timeLineModel = mFeedList.get(position);

        if (position == 0) {
            holder.wuliu_title.setTextColor(Color.parseColor("#01c475"));
            holder.wuliu_time.setTextColor(Color.parseColor("#01c475"));
        } else {
            holder.wuliu_title.setTextColor(Color.parseColor("#444444"));
            holder.wuliu_time.setTextColor(Color.parseColor("#999999"));
        }

        holder.wuliu_title.setText(timeLineModel.getAcceptStation());
        holder.wuliu_time.setText(timeLineModel.getAcceptTime());

    }

    @Override
    public int getItemCount() {
        return (mFeedList != null ? mFeedList.size() : 0);
    }


}
